ISCPropertyBag Interface

The following table contains information on the ISCPropertyBag interface:

Signature

Description

Valid Arguments

VARIANT_BOOL Add(BSTR Name, VARIANT Value)

Adds a new property to the bag

Value:

All VARIANTs are valid. The function returns TRUE if the property was added to the bag, otherwise, it is FALSE.

Example 4

The following example illustrates how to create a new persistence unit using C++. The example uses the Application object created in Example 1:

ISCPersistenceUnitPtr CreateNewModel(ISCApplicationPtr & scAppPtr)
{    
      ISCPersistenceUnitCollectionPtr scPUnitColPtr;
      scPUnitColPtr = scAppPtr->GetPersistenceUnits();
      
      ISCPropertyBagPtr propBag;
      HRESULT hr =propBag.CreateInstance(__uuidof(SCAPI::PropertyBag));
      if (FAILED(hr))
         return;
      propBag->Add("Name", �Test Model�);
      propBag->Add("ModelType", �Logical�);
      ISCPersistenceUnitPtr scPUnitPtr = scPUnitColPtr->Create(propBag,vtMissing);
      return scPUnitPtr;
}

The following example illustrates how to create a new persistence unit using Visual Basic .NET. The example uses the Application object created in Example 1:

Public Function CreateNewModel(ByRef scApp As SCAPI.Application) As SCAPI.PersistenceUnit
     Dim scPersistenceUnitCol as SCAPI.PersistenceUnits    
     scPersistenceUnitCol = scApp.PersistenceUnits
     
     Dim propBag As New SCAPI.PropertyBag
     
     propBag.Add("Name", "Test Model")
     propBag.Add("ModelType", 0)
     CreateNewModel = scPersistenceUnitCol.Create(propBag)
End Function